<template>
    <div>
        <button class="box" :disabled="disabled" @click="doClick" :style="{backgroundColor: color}">
            <slot></slot>
        </button>
    </div>
</template>

<script>
export default {
  name: 'PackagingMyButton',
  props: {
    type: {
      type: String,
      default: () => 'gray'
    },
    disabled: {
      type: Boolean,
      default: false
    }

  },
  data () {
    return {
      color: 'gray'
    }
  },

  created () {
    console.log(this.type)
    if (this.type === 'aaa') {
      this.color = 'red'
    } else if (this.type === 'bbb') {
      this.color = 'yellow'
    } else if (this.type === 'ccc') {
      this.color = 'skyblue'
    }
  },
  mounted () {
  },

  methods: {
    doClick () {
      console.log(111)
    }
  }
}
</script>

<style lang="less" scoped>
.box {
    width: 100px;
    height: 40px;
    line-height: 40px;
    text-align: center;
    cursor: pointer;
}
</style>
